import java.util.Scanner;

public class Test{
    public static void test1(int[] a) throws CloneNotSupportedException,
            NullPointerException,
            ArrayIndexOutOfBoundsException {
        if(a == null){
            throw new CloneNotSupportedException("");
        }
    }

    public static void main4(String[] args) throws CloneNotSupportedException,NullPointerException,ArrayIndexOutOfBoundsException {
        test1(null);
    }
    public static void main1(String[] args) {
        System.out.println(10/0);
    }

    public static void main3(String[] args) {
        int[] array = null;
        System.out.println(array.length);
    }

    public static void main2(String[] args) {
        int[] array = {1,2,3,4,5};
        System.out.println(array[10]);
        System.out.println("12345");
    }

    public static void main5(String[] args) {
        try (Scanner scanner = new Scanner(System.in)) {
            //test1(null);
            int a = scanner.nextInt();
            int[] array = {1, 2, 3};
            System.out.println(array[1]);
//            int[] array = null;
//            System.out.println(array.length);
//            System.out.println(10/0);
//            int[] array2={1,2,3,4,5};
//            System.out.println(array2[10]);
        } catch (ArrayIndexOutOfBoundsException e) {
            e.printStackTrace();
            System.out.println("捕捉到了 ArrayIndexOutOfBoundsException 异常，进行处理异常的逻辑");
        } catch (ArithmeticException e) {
            e.printStackTrace();
            System.out.println("捕捉到了 ArithmeticException 异常，进行处理异常的逻辑");
        } finally {
            System.out.println("finally 一般被用于资源的释放....");
        }
        System.out.println("正常的逻辑......");
    }
    public static int func(){
        try{
            int a = 10;
            return a;
        }catch(ArrayIndexOutOfBoundsException e){
            return 3;
        }finally{
            return 8;
        }
    }
    public static void main(String[] args) {
        System.out.println(func());
    }
}
